package PAT.乙.模拟;

import java.util.Scanner;
import java.util.zip.CheckedOutputStream;

/**
 * 数字分类
 *
 * @author yang
 * @date 2021/12/16
 */
public class 数字分类 {

    static int N = 1010;
    static int[] arr = new int[N];
    static int[] res = new int[5];
    static int[] count = new int[5];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if ((arr[i] % 5) == 0) {
                if ((arr[i] % 2) == 0) {

                    res[0] += arr[i];
                    count[0]++;
                }
            }
            if ((arr[i] % 5) == 1) {
                if ((count[1] % 2) == 0) res[1] += arr[i];
                else res[1] -= arr[i];
                count[1]++;
            }
            if ((arr[i] % 5) == 2) count[2]++;
            if ((arr[i] % 5) == 3) {
                res[3] += arr[i];
                count[3]++;
            }
            if ((arr[i] % 5) == 4) {
                if (res[4] < arr[i]) {
                    res[4] = arr[i];
                }
                count[4]++;
            }
        }
        if (count[0] != 0) System.out.print(res[0] + " ");
        else System.out.print("N" + " ");
        if(count[1] != 0) System.out.print(res[1] + " ");
        else System.out.print("N" + " ");
        if(count[2] != 0) System.out.print(count[2] + " ");
        else System.out.print("N" + " ");
        if(count[3] != 0) System.out.printf("%.1f ",(double)res[3] / count[3]);
        else System.out.print("N" + " ");
        if(count[4] != 0) System.out.print(res[4]);
        else System.out.print("N");
    }
 }
